package se.chalmers.tda366.crumble.gui.components;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;

import javax.swing.JButton;
import javax.swing.JToolBar;

import se.chalmers.tda366.crumble.core.IFeed;
import se.chalmers.tda366.crumble.gui.utils.GuiObserv;
import se.chalmers.tda366.crumble.resources.Constants;


public class FeedToolBar extends JToolBar{
	public FeedToolBar(List<IFeed> list){
		this.setFloatable(false);
		for(int i=0; i<list.size(); i++){
			FeedButton button = new FeedButton(list.get(i));
			button.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent evt) {
						GuiObserv.getInstance().fireNotify((JButton)evt.getSource(), Constants.Actions.SHOW_FEED);
				}
			});
			button.setText(list.get(i).getName());
			this.add(button);
		}
	}

}
